<%@page session="false"%>
<%@page import="java.net.*,java.io.*" %>
<%@ page pageEncoding="UTF-8" isELIgnored="false" %>
<%
	/**
	 *为实现客户端跨域请求而采用jsp制作的代理转发器
	 *使用方式：
	 *将该文件放在iserver webapps下面你的工程目录下，请求格式：http://localhost:8090/yourRoot/Proxy.jsp?url=yoururl,注意url参数中特殊字符需要转码。
	 *支持post，get请求
	 */
	String url0 = "";
	OutputStream out1 = null;
	HttpURLConnection conn = null;

	try {
		url0 = request.getQueryString();
		if (url0.startsWith("url=")) {
			url0 = url0.substring(4);
		}

		if (url0.indexOf("requestTime") != -1) {
			url0 = url0.split("requestTime")[0];
			url0 = url0.substring(0, url0.length() - 1);
		}

		URL url = new URL(url0);
		conn = (HttpURLConnection)url.openConnection();
		conn.setRequestMethod("GET");
		conn.setDoOutput(true);
		conn.setDoInput(true);
		conn.setUseCaches(false);
		out1 = response.getOutputStream();
		response.setContentType("text/xml; charset=UTF-8");
		BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
		BufferedWriter wd = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), "UTF-8"));

		for(String tempLine = rd.readLine(); tempLine != null; tempLine = rd.readLine()) {
			wd.write(tempLine);
			System.out.println(tempLine);
			//logger.info(tempLine);
		}

		wd.flush();
		System.out.println("\n请求地址: " + url0 + "\n请求成功!");
		//logger.info("\n请求地址: " + url0 + "\n请求成功!");
	} catch (Exception var18) {
		System.out.println("请求地址: " + url0 + "\n请求失败: " + var18);
		//	logger.error("请求地址: " + url0 + "\n请求失败: " + var18);
		response.sendError(500);
	} finally {
		try {
			if (out != null) {
				out1.close();
			}

			if (conn != null) {
				conn.disconnect();
			}
		} catch (Exception var17) {
		}
	}
%>